package com.wgc.goods.controller;

import com.wgc.entity.Result;
import com.wgc.goods.domain.Classify;
import com.wgc.goods.service.ClassifyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
/**
 * 商品分类
 */
@RestController
@RequestMapping("/classify")
public class ClassifyController {
    @Autowired
    private ClassifyService classifyService;
    /**
     * 查询全部
     */
    @RequestMapping("/selectAll")
    public Result<List<Classify>>  selectAll(){
        return new Result<>("success",classifyService.selectAll());
    }

    /**
     * 插入
     */
    @RequestMapping("/insert")
    public Result<Integer> insert(@RequestBody Classify classify) {
        classifyService.insert(classify);
        return new Result<>("插入成功");
    }

    /**
     * 更新数据
     */
    @RequestMapping("/update")
    public Result<Integer> update(@RequestBody Classify classify) {
        classifyService.update(classify);
        return new Result<>("更新成功");
    }

    /**
     * 删除数据
     */
    @RequestMapping("/delete")
    public Result<Integer> delete(@RequestParam String ids) {
        classifyService.delete(ids);
        return new Result<>("删除成功");
    }


}
